package feign;/**
 * @author XuXiaoK
 * @create 2020-01-20 19:55
 */


import com.sun.xml.internal.bind.api.JAXBRIContext;
import com.sun.xml.internal.bind.api.TypeReference;
import com.sun.xml.internal.ws.api.model.SEIModel;
import com.sun.xml.internal.ws.developer.JAXBContextFactory;
import entity.Person;
import feign.gson.GsonDecoder;
import feign.gson.GsonEncoder;
import service.PersonClient;

import javax.xml.bind.JAXBException;
import java.util.List;


/**
 * @Author XiaoKe
 * @Date 2020/1/20 19:55
 * @Description TODO
 */
public class PersonMain {

    public static void main(String[] args) {
        PersonClient personService = Feign.builder()
                .encoder(new GsonEncoder())
                .target(PersonClient.class, "http://localhost:8777/");

        Person person = Person.builder()
                .id(1)
                .name("xiaoke")
                .age(22).build();
        String person1 = personService.createPerson(person);
        System.out.println(person1);
    }

    static void demo2() {

    }

    //解码器测试
    static void demo() {
        PersonClient personService = Feign.builder()
                .decoder(new GsonDecoder())
                .target(PersonClient.class, "http://localhost:8772/");
        Person person = personService.findById(2);
        System.out.println(person.getId()+person.getName()+person.getAge());
    }
    //编码器测试
    static void demo1() {
        PersonClient personService = Feign.builder()
                .encoder(new GsonEncoder())
                .target(PersonClient.class, "http://localhost:8777/");

        Person person = Person.builder()
                .id(1)
                .name("xiaoke")
                .age(22).build();
        String person1 = personService.createPerson(person);
        System.out.println(person1);
    }
}
